module.exports   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 1
b 0
f 0
1
'use strict';
2
3
module.exports = function (grunt) {
4
    // Time how long tasks take. Can help when optimizing build times
5
    require('time-grunt')(grunt);
6
7
    // Automatically load required grunt tasks
8
    require('jit-grunt')(grunt, {
9
        lockfile: 'grunt-lock'
10
    });
11
12
    // Configurable paths
13
    var config = {
14
        resources_dir: 'Resources/',
15
        public_dir: 'Resources/public/'
16
    };
17
18
    // Define the configuration for all the tasks
19
    grunt.initConfig({
20
        // Project settings
21
        config: config,
22
23
        //Prevent multiple grunt instances
24
        lockfile: {
25
            grunt: {
26
                path: 'grunt.lock'
27
            }
28
        },
29
30
        // Watches files for changes and runs tasks based on the changed files
31
        watch: {
32
            gruntfile: {
33
                files: ['Gruntfile.js'],
34
                options: {
35
                    reload: true
36
                }
37
            },
38
            sass: {
39
                files: ['<%= config.resources_dir %>/sass/{,*/}*.{scss,sass}'],
40
                tasks: ['sass', 'postcss']
41
            }
42
        },
43
44
        // Compiles Sass to CSS and generates necessary files if requested
45
        sass: {
46
            options: {
47
                sourceMap: true,
48
                sourceMapEmbed: true,
49
                sourceMapContents: true,
50
                includePaths: ['.']
51
            },
52
            dist: {
53
                files: [{
54
                    expand: true,
55
                    cwd: '<%= config.resources_dir %>/sass',
56
                    src: ['*.{scss,sass}'],
57
                    dest: '.tmp/css',
58
                    ext: '.css'
59
                }]
60
            }
61
        },
62
63
        postcss: {
64
            options: {
65
                map: true,
66
                processors: [
67
                    // Add vendor prefixed styles
68
                    require('autoprefixer-core')({
69
                        browsers: ['> 1%', 'last 3 versions', 'Firefox ESR', 'Opera 12.1']
70
                    })
71
                ]
72
            },
73
            dist: {
74
                files: [{
75
                    expand: true,
76
                    cwd: '.tmp/css/',
77
                    src: '{,*/}*.css',
78
                    dest: '<%= config.public_dir %>/css'
79
                }]
80
            }
81
        }
82
    });
83
84
    grunt.registerTask('serve', 'Start the server and preview your app', function () {
85
        grunt.task.run([
86
            'lockfile',
87
            'sass:dist',
88
            'postcss',
89
            'watch'
90
        ]);
91
    });
92
93
    grunt.registerTask('default', [
94
        'serve'
95
    ]);
96
};
97